package com.qpx.jxcmessage.sort;


import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ProducerSort {

    @Autowired
    RabbitTemplate rabbitTemplate;

    public void sendMessage() throws InterruptedException {
        for (int i = 1;i<=100000;i++){
            //log.info("生产者发送的消息是:message"+i);
            Thread.sleep(100);
            rabbitTemplate.convertAndSend("sortTestExchange","sort.#","message"+i);
        }
    }
}
